package com.zdsoft.finance.organization.entity;


import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.zdsoft.framework.core.common.domain.BaseEntity;



/**
 * 
 * 版权所有：重庆正大华日软件有限公司
 * @Title:LoanOrganization.java
 * @Package:com.zdsoft.finance.entity.basedata.organization
 * @Description:合作机构基础 实体
 * @author: dengyy
 * @date:2016年10月20日 下午12:10:46
 * @version:v1.0
 */
@Entity
@Table(name="zds_loanorganization")
@Inheritance(strategy = InheritanceType.JOINED)
public class LoanOrganization extends BaseEntity {

    private static final long serialVersionUID = -2193817508375491834L;

    /**
     *  合作机构类型 和simplecode关联 
     *  code:org_01 , fullcode:org_01 ,name：银行
     *  code:org_02 , fullcode:org_02,name：证券公司
     *  code:org_03 , fullcode:org_03 ,name：P2P平台
     *  code:org_04 , fullcode:org_04 ,name：小贷公司
     *  code:org_05 , fullcode:org_05 ,name：评估机构
     *  code:org_06 , fullcode:org_06 ,name：其他机构
     */
    @Column(length=32)
    private String orgType ;
    
    /**
     * 合作机构名称
     */
    @Column(length=64)
    private String orgName ;
    
    /**
     * 合作机构全称
     */
    @Column(length=128)
    private String orgFullName ;
    
    /**
     * 机构代码
     */
    @Column(length=32)
    private String orgCode ;
    
    /**
     * 联系人
     */
    @Column(length=64)
    private String contactMan ;
    
    /**
     * 联系电话
     */
    @Column(length=11)
    private String telephone ;
    
    /**
     * 备注
     */
    @Lob
    private String remark ;
    
    /**
     * 是否自动续约
     */
    @Column(columnDefinition="boolean")
    private Boolean autoRenew = false ;
    
    /**
     * 是否启用
     */
    @Column(columnDefinition="boolean")
    private Boolean enable = false;
    
	/**
     * 上级单位
     */
    @ManyToOne
    private LoanOrganization parent;

    /**
     * 下级单位
     */
    @OneToMany(mappedBy = "parent",fetch=FetchType.LAZY, cascade = CascadeType.ALL)
    private List<LoanOrganization> children = new ArrayList<LoanOrganization>();
    
    /**
     * 检索码
     */
    @Column(length=32)
    private String searchCode ;
    
    /**
     * 合作协议附件（多个以逗号隔开）
     */
    @Column(length=500)
    private String cooperationAttachment ;
    
    /**
     * 授信开始日期
     */
    @Column(length=16)
    private Long creditBeginDate ;
    
    /**
     * 授信结束日期
     */
    @Column(length=16)
    private Long creditEndDate ;
    
    /**
     * 授信额度
     */
    @Column(precision=15,scale=2)
    private BigDecimal creditAmount ;
    
    /**
     * 授信余额
     */
    @Column(precision=15,scale=2)
    private BigDecimal  creditBalance ;
    /**
     * 父级id
     */
    private transient String parent_id;
    
    public String getParent_id() {
		return parent_id;
	}

	public void setParent_id(String parent_id) {
		this.parent_id = parent_id;
	}

	public String getOrgType() {
        return orgType;
    }

    public void setOrgType(String orgType) {
        this.orgType = orgType;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getOrgFullName() {
        return orgFullName;
    }

    public void setOrgFullName(String orgFullName) {
        this.orgFullName = orgFullName;
    }

    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    public String getContactMan() {
        return contactMan;
    }

    public void setContactMan(String contactMan) {
        this.contactMan = contactMan;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Boolean getAutoRenew() {
        return autoRenew;
    }

    public void setAutoRenew(Boolean autoRenew) {
        this.autoRenew = autoRenew;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public String getSearchCode() {
        return searchCode;
    }

    public void setSearchCode(String searchCode) {
        this.searchCode = searchCode;
    }
    
    public LoanOrganization getParent() {
  		return parent;
  	}

  	public void setParent(LoanOrganization parent) {
  		this.parent = parent;
  	}

  	public List<LoanOrganization> getChildren() {
  		return children;
  	}

  	public void setChildren(List<LoanOrganization> children) {
  		this.children = children;
  	}

  	public String getCooperationAttachment() {
  		return cooperationAttachment;
  	}

  	public void setCooperationAttachment(String cooperationAttachment) {
  		this.cooperationAttachment = cooperationAttachment;
  	}

	public Long getCreditBeginDate() {
		return creditBeginDate;
	}

	public void setCreditBeginDate(Long creditBeginDate) {
		this.creditBeginDate = creditBeginDate;
	}

	public Long getCreditEndDate() {
		return creditEndDate;
	}

	public void setCreditEndDate(Long creditEndDate) {
		this.creditEndDate = creditEndDate;
	}

	public BigDecimal getCreditAmount() {
		return creditAmount;
	}

	public void setCreditAmount(BigDecimal creditAmount) {
		this.creditAmount = creditAmount;
	}

	public BigDecimal getCreditBalance() {
		return creditBalance;
	}

	public void setCreditBalance(BigDecimal creditBalance) {
		this.creditBalance = creditBalance;
	}

 
}
